package JLB_Chapter_07;

// 定义接口
interface drawTest {
    // 定义方法
    public void draw();
}

class ParallelogramgleUseInteface implements drawTest {
    // 由于该类实现了接口，所以需要覆盖draw()方法
    public void draw() {
        System.out.println("平行四边形.draw()");
    }
}

class SquareUseInterface implements drawTest {
    public void draw() {
        System.out.println("正方形.draw()");
    }
}

public class QuadrangleUseInterface {
    public static void main(String[] args) {
        // 接口执行向上转型操作
        drawTest[] d = {new SquareUseInterface(), new ParallelogramgleUseInteface()};

        for (int i = 0; i < d.length; i++) {
            d[i].draw();
        }
    }
}
